.container {
  width: 200px;
  height: 200px;
  position: relative;
}

.box1 , .box2 {
  width: 100px;
  height: 100px;
  position: absolute;
  border-radius: 5px;
}

.box1 {
  top: 30px;
  left: 30px;
  background-color: lightcoral;
}
.box2 {
  background-color: lightblue;
  animation: opacity 5s infinite;
}
@keyframes opacity {
  50%{
    opacity: 0;
  }
}